<template>
  <div class="join flex items-center justify-center">
    <button
      v-for="(_, idx) in new Array(pageCount)"
      :class="`join-item btn btn-xl ${
        currentPage == idx + 1 ? 'btn-active' : ''
      }`"
      @click="handlePage(idx + 1)"
    >
      {{ idx + 1 }}
    </button>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
const router = useRouter();
defineProps(["currentPage", "pageCount"]);

function handlePage(page) {
  router.push({ query: { page } });
}
</script>
